 package server;

 import client.MapleClient;
 import client.anticheat.CheatingOffense;
 import handling.channel.ChannelServer;
 import java.awt.Point;
 import scripting.portal.PortalScriptManager;
 import server.maps.MapleMap;
 import tools.MaplePacketCreator;


 public class MaplePortal
 {
   public static final int DOOR_PORTAL = 6;
/*  15 */   public static int MAP_PORTAL = 2;

   private final int type;

   private String name;
   private String target;
   private String scriptName;

   public MaplePortal(int type) {
/*  24 */     this.type = type;
   }
   private Point position; private int targetmap; private int id; private boolean portalState = true;
   public int getId() {
/*  28 */     return this.id;
   }

   public void setId(int id) {
/*  32 */     this.id = id;
   }

   public String getName() {
/*  36 */     return this.name;
   }

   public void setName(String name) {
/*  40 */     this.name = name;
   }

   public Point getPosition() {
/*  44 */     return this.position;
   }

   public void setPosition(Point position) {
/*  48 */     this.position = position;
   }

   public String getTarget() {
/*  52 */     return this.target;
   }

   public void setTarget(String target) {
/*  56 */     this.target = target;
   }

   public int getTargetMapId() {
/*  60 */     return this.targetmap;
   }

   public void setTargetMapId(int targetmapid) {
/*  64 */     this.targetmap = targetmapid;
   }

   public int getType() {
/*  68 */     return this.type;
   }

   public String getScriptName() {
/*  72 */     return this.scriptName;
   }

   public void setScriptName(String scriptName) {
/*  76 */     this.scriptName = scriptName;
   }

   public void enterPortal(MapleClient c) {
/*  80 */     if (getPosition().distanceSq(c.getPlayer().getPosition()) > 40000.0D && !c.getPlayer().isGM()) {
/*  81 */       c.announce(MaplePacketCreator.enableActions());
/*  82 */       c.getPlayer().getCheatTracker().registerOffense(CheatingOffense.USING_FARAWAY_PORTAL);
       return;
     }
/*  85 */     MapleMap currentmap = c.getPlayer().getMap();
/*  86 */     if (!c.getPlayer().hasBlockedInventory() && (this.portalState || c.getPlayer().isGM())) {
/*  87 */       if (getScriptName() != null) {
/*  88 */         c.getPlayer().checkFollow();
         try {
/*  90 */           PortalScriptManager.getInstance().executePortalScript(this, c);
/*  91 */         } catch (Exception e) {
/*  92 */           e.printStackTrace();
         }
/*  94 */       } else if (getTargetMapId() != 999999999) {
/*  95 */         MapleMap to = ChannelServer.getInstance(c.getChannel()).getMapFactory().getMap(getTargetMapId());
/*  96 */         if (to == null) {
/*  97 */           c.announce(MaplePacketCreator.enableActions());
           return;
         }
/* 100 */         if (!c.getPlayer().isGM() && 
/* 101 */           to.getLevelLimit() > 0 && to.getLevelLimit() > c.getPlayer().getLevel()) {
/* 102 */           c.getPlayer().dropMessage(-1, "You are too low of a level to enter this place.");
/* 103 */           c.announce(MaplePacketCreator.enableActions());




           return;
         }



/* 113 */         c.getPlayer().changeMapPortal(to, (to.getPortal(getTarget()) == null) ? to.getPortal(0) : to.getPortal(getTarget()));
       }
     }
/* 116 */     if (c.getPlayer() != null && c.getPlayer().getMap() == currentmap) {
/* 117 */       c.announce(MaplePacketCreator.enableActions());
     }
   }

   public boolean getPortalState() {
/* 122 */     return this.portalState;
   }

   public void setPortalState(boolean ps) {
/* 126 */     this.portalState = ps;
   }
 }


/* Location:              C:\PGX\Server.jar!\server\MaplePortal.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */